package utils

import "golang.org/x/crypto/bcrypt"

func Encrypto(str string) (string, error) {
	enStr, err := bcrypt.GenerateFromPassword([]byte(str), bcrypt.DefaultCost)
	if err != nil {
		return "", err
	}
	return string(enStr), err
}

func DeCrypto(hashPw, pw string) error {
	err := bcrypt.CompareHashAndPassword([]byte(hashPw), []byte(pw))
	return err
}
